﻿<UserControl
  x:Class="NuGet.WebMatrix.NuGetButtonBar"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:self="clr-namespace:NuGet.WebMatrix"
  xmlns:framework="clr-namespace:Microsoft.WebMatrix.Core;assembly=Microsoft.WebMatrix.Core"
  mc:Ignorable="d"
  d:DesignWidth="300">
  <UserControl.Resources>
    <CollectionViewSource
      Source="{Binding Path=NuGetViewModel.PackageSourcesViewModel.FeedSources}"
      x:Key="FeedSources" />
  </UserControl.Resources>
  <Grid Margin="-700,0,0,0">
    <ComboBox
        AutomationProperties.AutomationId="sourceManagerCombobox"
        x:Name="_comboBox"
        Height="24"
        Width="135"
        Margin="10,10,10,10"
        HorizontalAlignment="Left"
        SelectedItem="{Binding Path=NuGetViewModel.SelectedFeedSourceItem, Mode=TwoWay}"
        DisplayMemberPath="Name"
        SelectionChanged="ComboBox_SelectionChanged"
        Visibility="{Binding Path=NuGetViewModel.ShowFeedSourceComboBox, Mode=OneWay}">
        <ComboBox.ItemsSource>
            <CompositeCollection>
                <CollectionContainer
            Collection="{Binding Source={StaticResource FeedSources}}" />
                <ComboBoxItem
            Content="{x:Static self:Resources.String_AddSourceEllipse}" />
            </CompositeCollection>
        </ComboBox.ItemsSource>
    </ComboBox>

    <!-- Combo Box above ends in line with the list view pointer's right border. ListViewPointer is the left pane -->    
    <!-- Combo Box below starts in line with the package ListViewItem's left border. Each package listed is on a ListViewItem -->
    <!-- Margins are set accordingly -->
    <ComboBox
        x:Name="_includePrereleaseComboBox"
        Height="24"
        Width="125"
        Margin="157,10,10,10"
        HorizontalAlignment="Left"
        SelectedItem="{Binding Path=NuGetViewModel.SelectedPrereleaseFilter, Mode=TwoWay}"
        Visibility="{Binding Path=NuGetViewModel.ShowPrereleaseFilter, Mode=OneWay}"
        ItemsSource="{Binding Path=PrereleaseFilter, Mode=OneWay}">
    </ComboBox>

    <ItemsControl
      ItemsSource="{Binding ActionButtons}"
      Focusable="False"
      HorizontalAlignment="Right">
      <ItemsControl.Resources>
        <DataTemplate
          DataType="{x:Type self:ButtonViewModel}">
          <Button
            AutomationProperties.AutomationId="{Binding InvariantName}"
            Command="{Binding Command}"
            CommandParameter="{Binding CommandParameter}"
            Content="{Binding Text}" 
            IsCancel="{Binding IsCancel}"/>
        </DataTemplate>
      </ItemsControl.Resources>
      <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
          <StackPanel
            Orientation="Horizontal" />
        </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>
    </ItemsControl>
  </Grid>
</UserControl>
